package cn.changeforyou.web.blog.vo;

import lombok.Data;

/**
 * @author zhyu
 * @date 2021/3/19 16:26
 */
@Data
public class R<T> {

    private int status;

    private String error;

    private T data;

    private R() {
    }

    public R(int status, String error, T data) {
        this.status = status;
        this.error = error;
        this.data = data;
    }

    public static R suc(Object data) {
        return new R(0, null, data);
    }

    public static R suc() {
        return new R(0, null, null);
    }

    public static R fail(String error) {
        return new R(-1, error, null);
    }
}
